﻿var t1;

milwaukeeans = {}

$(document).ready(function () {
    milwaukeeans.init();
});

milwaukeeans = {
    init: function () {
        milwaukeeans.util.animateBg();
    }
}

milwaukeeans.util = {
    animateBg: function () {
        $("#bg img").hide();
        $("#bg img:first").show();
        t1 = setTimeout(function () { milwaukeeans.util.changeBg(); }, 5000);

    },
    changeBg: function () {
        var current = $("#bg img:visible");
        var next;
        if ($(current).hasClass("last")) {
            next = $("#bg img:first");
        } else {
            next = $(current).next();
        }
        $(current).fadeOut(1000);
        $(next).fadeIn(1000);

        setTimeout(function () { milwaukeeans.util.changeBg(); }, 5000);
    }
}